const connection  = require('../app/database')

class AuthPermission {
    async checkResource(tableName, tableid, userId) {
        console.log(tableName, tableid)
        try {
            const statement = `SELECT * FROM ${tableName} WHERE id = ? AND user_id = ?;`
            const [result] = await connection.execute(statement, [tableid, userId])
            console.log(result,'d')
            return result.length === 0 ? false : true 
        } catch (error) {
            console.log(error)
        }
      
    }
}

module.exports = new AuthPermission()
